package com.flx.config;

import com.flx.Interceptor.JwtTokenInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


/**
 * @ClassName WebConfig
 * 指定拦截器的拦截路径
 * @Author 23207
 * @Date 2025/4/21 9:53
 * @Version 1.0
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
  @Autowired
  private JwtTokenInterceptor jwtTokenInterceptor;

  @Override
  public void addInterceptors(InterceptorRegistry registry) {
    // 添加拦截器，并指定拦截路径
    registry.addInterceptor(jwtTokenInterceptor).addPathPatterns("/**").excludePathPatterns("/login");
  }
}
